<div class="lian_cheng chantu layui-hide">
    <div class="men">
        <div class="xiaotit">总成本分析</div>
        <div class="float-l wd50">
            <div class="float-r" style="width: 455px;padding-top: 18px">
                <div class="fftt1 fw700">总成本/预算分析</div>
                <div style="height: 70px;width: 430px;background-color: #1CA5FF;margin-top: 20px;color: #FFFFFF;padding-left: 20px;padding-right: 5px">
                    <div class="fftt1" style="padding-top: 14px">总预算</div>
                    <div class="fftt1 fw700" style="cursor: pointer;"><span id="lian_cheng_budget_money">0</span></div>
                </div>
            </div>
        </div>
        <div class="float-r wd50">
            <div class="float-l" style="width: 450px;">
                <div class="fftt1 fw700 float-r">预算余额(总预算-总成本) <span class="fw700 colorlan" style="font-size: 26px" id="lian_cheng_budget_yufee">0</span></div>
                <div class="clear"></div>
                <div style="height: 70px;width: 430px;background-color: #FEA918;margin-top: 20px;color: #FFFFFF;padding-left: 20px;margin-left: 5px">
                    <div class="fftt1" style="padding-top: 14px">总成本</div>
                    <div class="fftt1 fw700" style="cursor: pointer;"><span id="lian_cheng_zongfee">0</span></div>
                </div>
            </div>
        </div>
        <div class="clear"></div>
        <div style="margin-top: 20px">
            <div class="layui-progress layui-progress-big jindulan" lay-showPercent="true" lay-filter="lian_cheng_budget_zongyurate" style="width: 910px;margin: 0 auto;">
                <div class="layui-progress-bar jinduhuang" lay-percent="0%"></div>
            </div>
            <div class="fftt1" style="width: 910px;margin: 0 auto;padding-top: 10px">总成本/预算占比： <span id="lian_cheng_budget_zongyurate">0  %</span></div>
        </div>

        <div class="clear" style="padding-top: 50px"></div>
    </div>

    <div class="xiaoxian"></div>
    <div class="men">
        <div class="xiaotit">分项成本分析</div>
        <div class="float-l wd50">
            <div class="float-l wd50">
                <div class="fw700" style="padding-bottom: 10px">预算分项占比</div>
                <div class="chart" id="lian_chart_yufen" style="height: 200px"></div>
            </div>
            <div class="float-l wd50" style="padding-top: 40px">
                <div class="float-l fangding" style="padding-left: 20px;padding-top: 5px;">
                    <span class="fanglan tuclr1"></span><span style="margin-left: 20px">材料：<span id="lian_cheng_budget_caifee">0</span></span>
                </div><div class="clear"></div>
                <div class="float-l fangding" style="padding-left: 20px;padding-top: 5px;">
                    <span class="fanglan tuclr2"></span><span style="margin-left: 20px">人工：<span id="lian_cheng_budget_renfee">0</span></span>
                </div><div class="clear"></div>
                <div class="float-l fangding" style="padding-left: 20px;padding-top: 5px;">
                    <span class="fanglan tuclr3"></span><span style="margin-left: 20px">机械设备：<span id="lian_cheng_budget_jifee">0</span></span>
                </div><div class="clear"></div>
                <div class="float-l fangding" style="padding-left: 20px;padding-top: 5px;">
                    <span class="fanglan tuclr4"></span><span style="margin-left: 20px">专业分包：<span id="lian_cheng_budget_fenfee">0</span></span>
                </div><div class="clear"></div>
                <div class="float-l fangding" style="padding-left: 20px;padding-top: 5px;">
                    <span class="fanglan tuclr5"></span><span style="margin-left: 20px">其他：<span id="lian_cheng_budget_qifee">0</span></span>
                </div>
            </div>
            <div class="clear"></div>
        </div>
        <div class="float-l wd50">
            <div class="float-l wd50">
                <div class="fw700" style="padding-bottom: 10px">成本分项占比</div>
                <div class="chart" id="lian_chart_chengfen" style="height: 200px"></div>
            </div>
            <div class="float-l wd50" style="padding-top: 40px">
                <div class="float-l fangding" style="padding-left: 20px;padding-top: 5px;">
                    <span class="fanglan tuclr1"></span><span style="margin-left: 20px">材料：<span id="lian_cheng_zhixiang_cai">0</span></span>
                </div><div class="clear"></div>
                <div class="float-l fangding" style="padding-left: 20px;padding-top: 5px;">
                    <span class="fanglan tuclr2"></span><span style="margin-left: 20px">人工：<span id="lian_cheng_zhixiang_ren">0</span></span>
                </div><div class="clear"></div>
                <div class="float-l fangding" style="padding-left: 20px;padding-top: 5px;">
                    <span class="fanglan tuclr3"></span><span style="margin-left: 20px">机械设备：<span id="lian_cheng_zhixiang_ji">0</span></span>
                </div><div class="clear"></div>
                <div class="float-l fangding" style="padding-left: 20px;padding-top: 5px;">
                    <span class="fanglan tuclr4"></span><span style="margin-left: 20px">专业分包：<span id="lian_cheng_zhixiang_fen">0</span></span>
                </div><div class="clear"></div>
                <div class="float-l fangding" style="padding-left: 20px;padding-top: 5px;">
                    <span class="fanglan tuclr5"></span><span style="margin-left: 20px">其他：<span id="lian_cheng_zhixiang_qi">0</span></span>
                </div>
            </div>
            <div class="clear"></div>
        </div>
        <div class="clear"></div>
        <div class="fw700" style="padding: 50px 0 50px 0;text-align: center">成本预算分项占比</div>
        <div style="margin-top: 20px">
            <div class="layui-progress layui-progress-big jindulan" lay-filter="lian_cheng_rate_cai" lay-showPercent="true" style="width: 910px;margin: 0 auto;">
                <div class="layui-progress-bar jinduhuang" lay-percent="0%"></div>
            </div>
            <div class="fftt1" style="width: 910px;margin: 0 auto;padding-top: 10px">
                <span style="display: inline-block;width: 300px"><span>材料费成本/预算占比：</span><span id="lian_cheng_rate_cai">0 %</span></span>
                <span><span>预算余额：</span><span id="lian_cheng_yufee_cai">0</span></span>
            </div>
        </div>
        <div style="margin-top: 20px">
            <div class="layui-progress layui-progress-big jindulan" lay-filter="lian_cheng_rate_ren" lay-showPercent="true" style="width: 910px;margin: 0 auto;">
                <div class="layui-progress-bar jinduhuang" lay-percent="0%"></div>
            </div>
            <div class="fftt1" style="width: 910px;margin: 0 auto;padding-top: 10px">
                <span style="display: inline-block;width: 300px"><span>人工费成本/预算占比：</span><span id="lian_cheng_rate_ren">0 %</span></span>
                <span><span>预算余额：</span><span id="lian_cheng_yufee_ren">0</span></span>
            </div>
        </div>
        <div style="margin-top: 20px">
            <div class="layui-progress layui-progress-big jindulan" lay-filter="lian_cheng_rate_ji" lay-showPercent="true" style="width: 910px;margin: 0 auto;">
                <div class="layui-progress-bar jinduhuang" lay-percent="0%"></div>
            </div>
            <div class="fftt1" style="width: 910px;margin: 0 auto;padding-top: 10px">
                <span style="display: inline-block;width: 300px"><span>机械设备费成本/预算占比：</span><span id="lian_cheng_rate_ji">0 %</span></span>
                <span><span>预算余额：</span><span id="lian_cheng_yufee_ji">0</span></span>
            </div>
        </div>
        <div style="margin-top: 20px">
            <div class="layui-progress layui-progress-big jindulan" lay-filter="lian_cheng_rate_fen" lay-showPercent="true" style="width: 910px;margin: 0 auto;">
                <div class="layui-progress-bar jinduhuang" lay-percent="0%"></div>
            </div>
            <div class="fftt1" style="width: 910px;margin: 0 auto;padding-top: 10px">
                <span style="display: inline-block;width: 300px"><span>专业分包费成本/预算占比：</span><span id="lian_cheng_rate_fen">0 %</span></span>
                <span><span>预算余额：</span><span id="lian_cheng_yufee_fen">0</span></span>
            </div>
        </div>
        <div style="margin-top: 20px">
            <div class="layui-progress layui-progress-big jindulan" lay-filter="lian_cheng_rate_qi" lay-showPercent="true" style="width: 910px;margin: 0 auto;">
                <div class="layui-progress-bar jinduhuang" lay-percent="0%"></div>
            </div>
            <div class="fftt1" style="width: 910px;margin: 0 auto;padding-top: 10px">
                <span style="display: inline-block;width: 300px"><span>其他费成本/预算占比：</span><span id="lian_cheng_rate_qi">0 %</span></span>
                <span><span>预算余额：</span><span id="lian_cheng_yufee_qi">0</span></span>
            </div>
        </div>
        <div class="clear"></div>
    </div>

</div>
<script>


    function func_lian_cheng() {
        layui.use(['laytp', 'form', 'element'], function() {
            var form = layui.form, layer = layui.layer, element = layui.element;

            facade.ajax({url: ask_engin_cha_lian_cheng,data:{enginid:param_enginid}}).done(function(res){
                if (res.code === 2000) {
                    var data = res.data;

                    $("#lian_cheng_budget_yufee").html(parseFormatNum(data.budget_yufee));
                    $("#lian_cheng_budget_money").html(parseFormatNum(data.budget_money));
                    $("#lian_cheng_zongfee").html(parseFormatNum(data.zongfee));
                    $("#lian_cheng_budget_zongyurate").html(data.budget_zongyurate+' %');
                    element.progress('lian_cheng_budget_zongyurate', data.budget_zongyurate+'%');

                    $("#lian_cheng_budget_caifee").html(parseFormatNum(data.budget_caifee));
                    $("#lian_cheng_budget_renfee").html(parseFormatNum(data.budget_renfee));
                    $("#lian_cheng_budget_jifee").html(parseFormatNum(data.budget_jifee));
                    $("#lian_cheng_budget_fenfee").html(parseFormatNum(data.budget_fenfee));
                    $("#lian_cheng_budget_qifee").html(parseFormatNum(data.budget_qifee));
                    lian_chart_yufen('lian_chart_yufen', data)


                    $("#lian_cheng_zhixiang_cai").html(parseFormatNum(data.zhixiang_cai)).addClass('colorlan').click(function () {
                        openNavPage('查看项目付款信息','zhi_xiang/index.php?status=1&feilei_option=xmzc_clf&enginid='+data.id);
                    });
                    $("#lian_cheng_zhixiang_ren").html(parseFormatNum(data.zhixiang_ren)).addClass('colorlan').click(function () {
                        openNavPage('查看项目付款信息','zhi_xiang/index.php?status=1&feilei_option=xmzc_rgf&enginid='+data.id);
                    });
                    $("#lian_cheng_zhixiang_ji").html(parseFormatNum(data.zhixiang_ji)).addClass('colorlan').click(function () {
                        openNavPage('查看项目付款信息','zhi_xiang/index.php?status=1&feilei_option=xmzc_jxsbf&enginid='+data.id);
                    });
                    $("#lian_cheng_zhixiang_fen").html(parseFormatNum(data.zhixiang_fen)).addClass('colorlan').click(function () {
                        openNavPage('查看项目付款信息','zhi_xiang/index.php?status=1&feilei_option=xmzc_zyfbf&enginid='+data.id);
                    });
                    $("#lian_cheng_zhixiang_qi").html(parseFormatNum(data.zhixiang_qi)).addClass('colorlan').click(function () {
                        openNavPage('查看项目付款信息','zhi_xiang/index.php?status=1&feilei_option=xmzc_qtf&enginid='+data.id);
                    });
                    lian_chart_chengfen('lian_chart_chengfen', data)


                    $("#lian_cheng_rate_cai").html(data.rate_cai+' %');
                    element.progress('lian_cheng_rate_cai', data.rate_cai+'%');
                    $("#lian_cheng_yufee_cai").html(parseFormatNum(data.yufee_cai));

                    $("#lian_cheng_rate_ren").html(data.rate_ren+' %');
                    element.progress('lian_cheng_rate_ren', data.rate_ren+'%');
                    $("#lian_cheng_yufee_ren").html(parseFormatNum(data.yufee_ren));

                    $("#lian_cheng_rate_ji").html(data.rate_ji+' %');
                    element.progress('lian_cheng_rate_ji', data.rate_ji+'%');
                    $("#lian_cheng_yufee_ji").html(parseFormatNum(data.yufee_ji));

                    $("#lian_cheng_rate_fen").html(data.rate_fen+' %');
                    element.progress('lian_cheng_rate_fen', data.rate_fen+'%');
                    $("#lian_cheng_yufee_fen").html(parseFormatNum(data.yufee_fen));

                    $("#lian_cheng_rate_qi").html(data.rate_qi+' %');
                    element.progress('lian_cheng_rate_qi', data.rate_qi+'%');
                    $("#lian_cheng_yufee_qi").html(parseFormatNum(data.yufee_qi));

                }
            });
        });
    }


    function lian_chart_yufen(chat_id, data) {
        var mychat = echarts.init(document.getElementById(chat_id), 'dark');
        mychat.clear();
        option = {
            color: [colors[1], colors[2], colors[3],colors[4], colors[5]],
            backgroundColor: '#FFFFFF',
            tooltip: {
                trigger: 'item'
            },
            series: [
                {
                    name: '预算分项占比',
                    type: 'pie',
                    radius: '80%',
                    data: [
                        { value: data.budget_caifee, name: '材料' },
                        { value: data.budget_renfee, name: '人工' },
                        { value: data.budget_jifee, name: '机械设备' },
                        { value: data.budget_fenfee, name: '专业分包' },
                        { value: data.budget_qifee, name: '其他' },
                    ],
                    emphasis: {
                        itemStyle: {
                            shadowBlur: 10,
                            shadowOffsetX: 0,
                            shadowColor: 'rgba(0, 0, 0, 0.5)'
                        }
                    }
                }
            ]
        };
        mychat.setOption(option);
    }
    function lian_chart_chengfen(chat_id, data) {
        var mychat = echarts.init(document.getElementById(chat_id), 'dark');
        mychat.clear();
        option = {
            color: [colors[1], colors[2], colors[3],colors[4], colors[5]],
            backgroundColor: '#FFFFFF',
            tooltip: {
                trigger: 'item'
            },
            series: [
                {
                    name: '成本分项占比',
                    type: 'pie',
                    radius: '80%',
                    data: [
                        { value: data.zhixiang_cai, name: '材料' },
                        { value: data.zhixiang_ren, name: '人工' },
                        { value: data.zhixiang_ji, name: '机械设备' },
                        { value: data.zhixiang_fen, name: '专业分包' },
                        { value: data.zhixiang_qi, name: '其他' },
                    ],
                    emphasis: {
                        itemStyle: {
                            shadowBlur: 10,
                            shadowOffsetX: 0,
                            shadowColor: 'rgba(0, 0, 0, 0.5)'
                        }
                    }
                }
            ]
        };
        mychat.setOption(option);
    }

</script>

